package frame;

import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;

import frame.data.contrldata;
import function.fileinfo;
import function.setting;

public class closefileconfirm extends JDialog{
	public closefileconfirm(fileinfo fi,String url,int se,master ma) {
		setTitle("VW-Edit 保存");
		setBounds(0, 0, 280, 145);
		setModal(true);
		setResizable(false);
		setIconImage(Toolkit.getDefaultToolkit().getImage("./material/logo/fvw.png"));
		setLocationRelativeTo(null);
		setLayout(null);
		JLabel a=new JLabel("该文件未保存，是否保存？",JLabel.CENTER);
		a.setBounds(0, 0, 280, 40);
		a.setFont(new Font("宋体",0,18));
		this.add(a);
		JLabel b=new JLabel(fi.getName(),JLabel.CENTER);
		b.setBounds(0, 40, 280, 20);
		this.add(b);
		JButton no=new JButton("不保存(N)");
		no.setBounds(10, 70, 120, 30);
		this.add(no);
		JButton yes=new JButton("保存(Y)");
		yes.setBounds(145, 70, 120, 30);
		this.add(yes);
		no.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				master.fl.deletefileofnum(se,ma);
				dispose();
			}
		});
		yes.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				dispose();
				new filesave(fi,url);
			}
		});
		setVisible(true);
	}
}
